<template>
  <div class="divBox relative">
    <el-card class="box-card">
      <el-row :gutter="20" style="min-height:50px; padding: 10px 30px 0px 30px;">
        <el-form :inline="true" size="medium">
          <el-row :gutter="20">
            <el-form-item label="查询条件">
              <el-select v-model="orderValue" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="getEntList">查询</el-button>
            </el-form-item>
          </el-row>
        </el-form>
      </el-row>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px;">
      <el-pagination
        layout="total,prev, pager, next"
        :current-page="tableData.page"
        :total="tableData.total"
        :page-size="tableData.limit"
        @current-change="pageChange"
      >
      </el-pagination>
      <el-table
        :data="tableData.list"
        style="width: 100%"
        v-loading="listLoading"
        :highlight-current-row="true"
        :header-cell-style=" {fontWeight:'bold'}"
      >
        <el-table-column
          type="index"
          width="50"
        >
        </el-table-column>
        <el-table-column
          prop="entFullName"
          label="企业名称"
          width="160"
        >
        </el-table-column>
        <el-table-column
          prop="cityName"
          label="行政区域"
          width="160"
        >
        </el-table-column>
        <el-table-column
          prop="industryTypeName"
          label="所属行业"
        >
        </el-table-column>
        <el-table-column
          prop="principal"
          label="联系人"
        >
        </el-table-column>
        <el-table-column
          prop="principalMphone"
          label="联系电话"
        >
        </el-table-column>

        <el-table-column
          prop="lastOftencheckDate"
          label="常普常新时间"
        >
        </el-table-column>
        <el-table-column
          prop="selfCheckDate"
          label="自查时间"
        >
        </el-table-column>
        <el-table-column
          prop="syncTime"
          label="更新时间"
        >
        </el-table-column>
      </el-table>
    </el-card>
  </div>

</template>

<script>
import { entList } from '@/api/safe'

export default {
  name: 'EntList',
  data() {
    return {
      tableData: {
        page: 1,
        limit: 10,
        list: [],
        total: 0,
        cityCode: '330285',
        entFullName: ''
      },
      listLoading: false,
      cpcxNearDay:10,
      selfCheckNearDay:7,
      options: [{
        value: '',
        label: '无'
      }, {
        value: 'self_check_date',
        label: '自查时间升序'
      }, {
        value: 'last_oftencheck_date',
        label: '常普常新时间升序'
      }],
      orderValue: ''
    }
  },
  mounted() {
    this.getEntList()
  },
  methods: {
    getEntList() {
      this.listLoading = true
      entList(this.tableData.cityCode, this.tableData.entFullName, this.tableData.page, this.tableData.limit,this.orderValue)
        .then(res => {
          this.listLoading = false
          this.tableData.list = res.list
          this.tableData.total = res.total
        }).catch(res => {
        this.listLoading = false
        this.$message.error(res.message)
      })
    },
    pageChange(page){
      this.tableData.page=page
      this.getEntList()
    }
  }
}
</script>

<style scoped>

</style>
